/**
 * 
 */
package cn.edu.bjtu.alex.rewrite.components;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cn.edu.bjtu.alex.rewrite.Context;
import cn.edu.bjtu.alex.rewrite.LifeCycle;

/**
 * @author alex
 *
 */
public abstract class BaseComponent implements LifeCycle{
	Context ctx;
	protected Log LOG;
	public BaseComponent(Context ctx){
		super();
		this.ctx = ctx;
	}
	//这叫钩子函数
	abstract protected void fitInternal();
	abstract protected void transformInternal();
	
	final public void fit(){
		this.LOG = LogFactory.getLog(this.getClass());
		fitInternal();
	}
	final public void transform(){
		this.LOG = LogFactory.getLog(this.getClass());
		transformInternal();
	}
}
